Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
Public Declare Function InternetGetConnectedState Lib "wininet.dll" (ByRef lpdwFlags As Long, ByVal dwReserved As Long) As Long
' // Returns true if connected to the internet.
Public Function CheckConnection() As Boolean
Dim result As Boolean
result = InternetGetConnectedState(0&, 0&) ' Simply test for an internet socket.
If result = False Then
CheckConnection = False
Else
CheckConnection = True
End If
End Function
Public Function DownloadFile(URL As String, LocalFilename As String) As Boolean